package com.fy56.platform.goodsTracking.service.impl;

import com.dexcoder.dal.JdbcDao;
import com.dexcoder.dal.build.Criteria;
import com.fy56.platform.goodsTracking.model.GoodstrackedRecordPublic;
import com.fy56.platform.goodsTracking.service.InfoQueryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by XTK on 2016-08-22.
 */
@Repository
public class InfoQueryServiceImpl implements InfoQueryService {
    @Autowired
    JdbcDao jdbcDao_GoodsTracked;
    @Override
    public List<GoodstrackedRecordPublic> query(String Tenant,String MasterId){
/*        Criteria criteria = Criteria.select(GoodstrackedRecordPublic.class).exclude("Consignmentbillnumber","Goodsnumber","Manualnumber")
                .where("organizationcode", new Object[] {Tenant })
                .and("consignmentbillmasterid", new Object[]{MasterId}).asc("systime");*/

        String Sql="SELECT CREATECOMPANYNAME,CREATEOPERATOR,DATATYPE,INFO,\n" +
                " ORGANIZATIONCODE,RECORDID,CONVERT(varchar(100), SysTime, 20) SYSTIME,TYPENAME,TYPENUM,UPLOAD,UPLOADERROR \n" +
                " FROM GOODSTRACKED_RECORD_PUBLIC WITH(NOLOCK) where organizationcode='"+Tenant+"'"+
                " and consignmentbillmasterid='"+MasterId+"' order by SysTime desc";
        List<GoodstrackedRecordPublic> list=jdbcDao_GoodsTracked.queryListForSql(Sql,GoodstrackedRecordPublic.class);
        return list;
    }
}
